package com.jy.api.controller;

import com.baidu.aip.speech.AipSpeech;
import com.jy.api.dao.CallConfigDao;
import com.jy.api.util.ImageFileOssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by hanxi on 2018/4/2.
 */
@RestController
public class SpeechController {
    private AipSpeech client;

    @Autowired
    private CallConfigDao callConfigDao;

    @GetMapping(path = "v1/pos/speech")
    public void getSpeech(String text, HttpServletResponse response) throws IOException {
        response.sendRedirect(ImageFileOssUtil.getAudioUrl(text));
    }

    @Autowired
    public void setClient(AipSpeech client) {
        this.client = client;
    }
}
